package com.learn.mybatis.k8s.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;
import java.net.UnknownHostException;

@RestController
@RequestMapping("/k8s")
public class K8sController {


    String result = "";
    @GetMapping("/k8s")
    public String k8s() {
        InetAddress address = null;
        try {
            address = InetAddress.getLocalHost();
            result = "hostname: " + address.getHostName() + "hostAddress: " + address.getHostAddress();
            System.out.println();
            System.out.println();
            System.out.println();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        return result;
    }

}
